package com.tangkun.environment.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.GridView;

/**
 * @author tangkun
 * @fileName:MyGridView.java
 * @description:TODO(与scrollView兼容的GridView)
 * @version:V1.0
 * @data: 2014年9月12日 下午3:59:07
 */
public class MyGridView extends GridView {

    public MyGridView(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    public MyGridView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyGridView(Context context) {
        super(context);
    }

    /*
     * 重写该方法，达到使GridView适应ScrollView的效果
     */
    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        // TODO Auto-generated method stub
        int expandSpec = MeasureSpec.makeMeasureSpec(Integer.MAX_VALUE >> 2, MeasureSpec.AT_MOST);
        super.onMeasure(widthMeasureSpec, expandSpec);

    }
}
